<?php
    if ($pagination->isCurrentFirstPage()) {
        $current_url_params = [];
    } else {
        $current_url_params = [
            'page' => $pagination->currentPage(),
        ];
    }

    $this->layout('reading.phtml', [
        'title' => $collection->name(),
        'canonical' => url_full('read list', $current_url_params),
        'current_tab' => 'reading',
        'current_page' => 'read',
        'reset_back_options' => true,
    ]);
?>

<div class="section__title">
    <h1><?= protect($collection->name()) ?></h1>
</div>

<p class="section__intro">
    <?= _('Find here all the links you’ve marked as read.') ?>
</p>

<?php if ($pagination->numberElements() > 0): ?>
    <div class="collection__number-links">
        <?= _nf('%s link', '%s links', $pagination->numberElements(), format_number($pagination->numberElements())) ?>
    </div>
<?php endif; ?>

<div class="cards">
    <?php foreach ($links as $link): ?>
        <?= $this->include('links/_link.phtml', [
            'link' => $link,
            'from' => \Minz\Url::for('read list', $current_url_params),
            'display_source' => $link->source_type !== 'bookmarks',
            'display_notes' => true,
            'display_edit' => true,
            'display_repair' => true,
            'display_delete' => true,
            'display_read_later' => 'auto',
            'display_mark_as_unread' => true,
        ]); ?>
    <?php endforeach; ?>
</div>

<?= $this->include('_pagination.phtml', ['pagination' => $pagination, 'url' => url('read list')]) ?>

<img
    class="illustration illustration--centered"
    alt=""
    src="<?= url_static('illustrations/collecting.svg') ?>"
    height="250"
/>
